# Contributor: Dmitry Romanenko <dmitry@romanenko.in>
# Maintainer: Peter Shkenev <santurysim@gmail.com>
pkgname=py3-setuptools_scm
_pkgname=setuptools-scm
pkgver=8.1.0
pkgrel=0
pkgdesc="The blessed package to manage your versions by scm tags"
url="https://github.com/pypa/setuptools_scm"
arch="noarch"
license="MIT"
depends="py3-setuptools py3-packaging"
makedepends="py3-gpep517 py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/${_pkgname/-/_}-$pkgver.tar.gz
	"
builddir="$srcdir/${_pkgname/-/_}-$pkgver"
options="!check" # here -> pytest -> pluggin -> here

replaces="py-setuptools_scm" # Backwards compatibility
provides="py-setuptools_scm=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	TZ=UTC .testenv/bin/python3 -m pytest -k 'not test_pip_download and not test_pyproject_support_with_git and not test_pretend_version_named_pyproject_integration'
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
205f1c122539d107a61a7ef01ff9ec225f7b2e6d92fc33a9f2a0c616051cbf32163ac4e6878d898e51cc1ff81fce6c6521a18fc5e09bdbc9d7d2467ba013c57f  setuptools_scm-8.1.0.tar.gz
"
